package com.uzai.common.enums;

/**
 * 订单状态
 * @Auther: liuqi
 * @Date: 2021/8/19 11:22
 * @Description:
 */
public enum OrderStatusEnum {

    STATUS_PAID(0,"订单付款"),
    STATUS_SETTLED(1,"订单结算"),
    STATUS_INVALID(2,"订单失效"),
    STATUS_REFUNDING(3,"维权创建"),
    STATUS_REFUND_SUCCESS(4,"维权成功"),
    STATUS_REFUND_FAIL(5,"维权失败"),
    STATUS_SUCCESS(6,"订单成功"),
    STATUS_INVALID_SPLIT(7,"失效拆单"),
    STATUS_PUNISH(8,"处罚订单");


    public static final int STATUS_PAID_VALUE = 0;
    public static final int STATUS_SETTLED_VALUE = 1;
    public static final int STATUS_INVALID_VALUE = 2;
    public static final int STATUS_REFUNDING_VALUE = 3;
    public static final int STATUS_REFUND_SUCCESS_VALUE = 4;
    public static final int STATUS_REFUND_FAIL_VALUE = 5;
    public static final int STATUS_SUCCESS_VALUE = 6;
    public static final int STATUS_INVALID_SPLIT_VALUE = 7;
    public static final int STATUS_PUNISH_VALUE = 8;

    public static final String STATUS_PAID_KEY = "Pay";
    public static final String STATUS_SETTLED_KEY = "Settle";
    public static final String STATUS_INVALID_KEY = "Invalid";
    public static final String STATUS_REFUND_KEY = "Refund";
    public static final String STATUS_PUNISH_KEY = "Punish";

    private Integer value;
    private String desc;

    OrderStatusEnum(Integer value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    public Integer getValue() {
        return value;
    }

    public void setValue(Integer value) {
        this.value = value;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    public static OrderStatusEnum getById(Integer id) {
        if (id == null) {
            return null;
        }
        for (OrderStatusEnum type: OrderStatusEnum.values()) {
            if (type.getValue().intValue() == id) {
                return type;
            }
        }
        return null;
    }
}
